﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using HP.Cachalote.WPF.ViewModel;
using HP.Cachalote.WPF.Shared;

namespace HP.Cachalote.WPF.UserControls
{
    /// <summary>
    /// Interaction logic for UnfinishedTodoItemTreeViewItemUserControl.xaml
    /// </summary>
    public partial class UnfinishedTodoItemTreeViewItemUserControl : UserControlBase
    {
        public UnfinishedTodoItemTreeViewItemUserControl()
        {
            InitializeComponent();
        }

        private void ChkDone_Clicked(object sender, RoutedEventArgs e)
        {
            var storyBoardSetItemAsDone = FindResource("StoryboardDone") as Storyboard;
            storyBoardSetItemAsDone.Completed += new EventHandler(StoryBoardSetItemAsDone_Completed);
            storyBoardSetItemAsDone.Begin();
        }

        private void StoryBoardSetItemAsDone_Completed(object sender, EventArgs e)
        {
            var viewModel = (TodoItemTreeViewItemViewModel)DataContext;
            viewModel.DoneCommand.Execute(null);
        }
    }
}
